package com.uniledger.exchange.model;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class AuthorizationInterceptor implements Interceptor{


    @Override
    public Response intercept(Chain chain) throws IOException {
        // get token
        String token = OkSingleton.getInstance().getToken();
        Request originalRequest = chain.request();
        // get new request, add request header
        Request updateRequest = originalRequest.newBuilder()
                .header("Authorization", token)
                .build();
        return chain.proceed(updateRequest);
    }


}
